//
//  JCCataCollectionViewCell.m
//  ABookOfCartoon
//
//  Created by 美国大狗 on 15-5-19.
//  Copyright (c) 2015年 Power Of Ants. All rights reserved.
//

#import "JCCataCollectionViewCell.h"
#import "UIImageView+WebCache.h"


@interface JCCataCollectionViewCell ()
@property (nonatomic, retain)UIImageView *picOfCartoon;
@property (nonatomic, retain)UILabel *NameOfCartoon;
@end

@implementation JCCataCollectionViewCell

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype) initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //加漫画预览图
        self.picOfCartoon = [[UIImageView alloc] init];
//        _picOfCartoon.backgroundColor = [UIColor cyanColor];
        [self.contentView addSubview:_picOfCartoon];

        [_picOfCartoon release];
        //加漫画名
        self.NameOfCartoon = [[UILabel alloc] init];
//            _NameOfCartoon.backgroundColor = [UIColor grayColor];
        [self.contentView addSubview:_NameOfCartoon];

        [_NameOfCartoon release];
    }
    return self;
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    _picOfCartoon.frame = CGRectMake(0, 0, self.contentView.bounds.size.width, self.contentView.bounds.size.height - 30);
    _NameOfCartoon.frame = CGRectMake(0, self.picOfCartoon.frame.size.height, self.contentView.bounds.size.width, 30);
}
- (void)setModel:(JCCataModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    //    [_picOfCata sd_setImageWithURL:[NSURL URLWithString:model.pic]];
    [_picOfCartoon sd_setImageWithURL:[NSURL URLWithString:model.CatalogOtherURL]placeholderImage:[UIImage imageNamed:@"/Users/dlios/ABookOfCartoon/ABookOfCartoon/9.jpg"]];
    _NameOfCartoon.text = model.CatalogName;
    _NameOfCartoon.textAlignment = UITextAlignmentCenter;
}







@end
